<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3 id="ti"></h3>
    <script>
/* 第一题 */
/*  var str = 'asdasdSMasdasdasdSMsdasdasdSMsadasd'
var res = str.replace("SM","**")
while(res.indexOf("SM") != -1)
{
	res = res.replace("SM","**")
}
console.log(res)
 */
/* 第二题 */

// 5.every 循环：所有都为true的时候 最终结果是true  只要有false 最终结果就是false
        // every  表单的全选  全选和非全选
        // var arr = [true,true,false];
        // var res =   arr.every(function(item){
        //     return item;
        // })
        // console.log(res);
        var arr = [0,0,0];
        Array.prototype.myEvery=function myEvery(arr){
            
        for(var i=0;i<this.length-1;i++){
if(this[i]!==this[i+1]){
    return false;
}
       }return true;
      
     }
     
 
 var res = arr.myEvery(function(item){
            return item;
        })
console.log(res);






















 
/*   第三题 */
    
/* function fn(date1,date2){ 
            var ca = (date2-date1)
           
            var day = parseInt(ca/1000/60/60/24) 
            
            var hour = ca - (day*1000*60*60*24) 
            hours = Math.floor(hour/1000/60/60) 
            var minute = hour-(hours*1000*60*60) 
            minutes = Math.floor(minute/1000/60)
            var second = minute-(minutes*1000*60) 
            seconds = Math.floor(second/1000)
            
            console.log(day+'天'+hours+'小时'+minutes+'分钟'+seconds+'秒');
            ti.innerHTML = day+'天'+hours+'小时'+minutes+'分钟'+seconds+'秒'; 
            setTimeout("fn(new Date(),new Date('2022/06/27 09:00:00'))", 1000) 
        }
        fn(new Date(),new Date('2022/06/27 09:00:00')) */
       /*  
        function fn(date){ 
           
       
            
            setTimeout("fn(new Date())", 1000) 
        }
        ti.innerHTML = fn(new Date()) */
        var a = new Date()
        console.log(a)
        a.getFullYear()
        a.getMonth()
        a.getDate()
        a.getHours()
        a.getMinutes()
        a.getSeconds()

    </script>
</body>
</html>